efform_onload = function ()
{
	if($('#flag').val()=='hidden')
	{
	   document.getElementById('ef_region_inqu').style.display = "none";
	}
};

button_query_onclick = function (){
	efgrid.submitInqu( "ef_grid_result", "ZM","ZMCG71","query");
}

button_insert_onclick = function (){
	var grid=isSelected("ef_grid_result");
	if (grid == 0)return; 
	
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG71","insert",true);
}

button_update_onclick = function (){
	var grid = isSelected("ef_grid_result");
	if (grid == 0) return;
	var rows = grid.getCheckedRows();
	for (var i = 0; i < rows.length; i++) {
		if (grid.getCellValueByColumnName(rows[i], "fdStatus") != "草拟") {
			EFAlert("只能对草拟的记录进行修改！");
			return;
		}
	}
	
	efgrid.submitForm( "ef_grid_result", "ZM","ZMCG71","update",true);
}

button_delete_onclick = function (){
	var grid = isSelected("ef_grid_result");
	if (grid == 0) return;
	var rows = grid.getCheckedRows();
	for (var i = 0; i < rows.length; i++) {
		if (grid.getCellValueByColumnName(rows[i], "fdStatus") != "草拟") {
			EFAlert("只能对草拟的记录进行删除！");
			return;
		}
	}
	EFConfirm('你确认要删除吗?', '确认框', function(r) {
		if(r)efgrid.submitForm( "ef_grid_result", "ZM","ZMCG71","delete",true);
	}); 
}

button_report_onclick = function() {
	var grid = isSelected("ef_grid_result");
	if (grid == 0) return;
	var rows = grid.getCheckedRows();
	for (var i = 0; i < rows.length; i++) {
		if (grid.getCellValueByColumnName(rows[i], "fdStatus") != "草拟") {
			EFAlert("只能对草拟的记录进行生效！");
			return;
		}
	}

	EFConfirm('你确认要生效吗?', '确认框',
	function(r) {
		if (r) {
			efgrid.submitForm("ef_grid_result", "ZM", "ZMCG71", "report", true);
		}
	});
}

efgrid_afterAddNewRow = function(grid_id) {
	var grid = efgrid.getGridObject(grid_id);
	var rows = grid.getCheckedRows();
	if (grid_id == "ef_grid_result") {
		for (var i = 0; i < rows.length; i++) {
			grid.getBlockData().setCell(rows[i], "fdStatus", "草拟");
			grid.getBlockData().setCell(rows[i], "fdCurrentDate", getCurrentDate());
		}
	}
	for (var i = 0; i < rows.length; i++) {
		grid.getBlockData().setCell(rows[i], "fdKeyId", "");
	}
}